home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / rlib.zip / RL_MREPL.PRG < prev    next >
Text File  |  1993-01-04  |  919b  |  39 lines

  1. * Function: MREPLACE
  2. * Author..: Richard Low
  3. * Syntax..: MREPLACE()
  4. * Returns.: True if successful.
  5. * Notes...: Procedure to replace fields in database with M->memvars
  6. *
  7.  
  8. FUNCTION MREPLACE
  9. PARAMETERS p_first, p_last
  10. PRIVATE f_alias, f_x, f_field
  11.  
  12. *-- if no fields in database or no file is open
  13. IF FCOUNT() = 0
  14.    *-- bomb out
  15.    RETURN .F.
  16. ENDIF
  17.  
  18. *-- see if they specified a starting field number, default to 1st field
  19. p_first = IF( TYPE('p_first') = 'N', p_first, 1 )
  20.  
  21. *-- see if they specified an ending field number, default to last field
  22. p_last = IF( TYPE('p_last') = 'N', p_last, FCOUNT() )
  23.  
  24. *-- get the alias name of the current database
  25. f_alias = ALIAS()
  26.  
  27. *-- go thru all fields in database
  28. FOR f_x = p_first TO p_last
  29.    f_field = FIELD(f_x)
  30.  
  31.    IF TYPE('M->&f_field') = 'U'
  32.       RETURN .F.
  33.    ENDIF
  34.  
  35.    REPLACE &f_alias.->&f_field WITH M->&f_field
  36. NEXT f_x
  37.  
  38. RETURN .T.
  39.